This invention relates to code interpretive virtual machines and in particular to a method and system for providing optimization information to the code interpretive virtual machine.
This invention is related to U.S. patent application Ser. No. 08/990,040 which is herein incorporated by reference in its entirety.
Code interpretive runtime systems, such as a Java Virtual Machine (JVM), which execute intermediate code in an interpretive mode are specially useful in embedded, real-time applications. In exchange for speed of execution provided by compiled code which is executable only on the specific platform it was compiled for, the intermediate code is extremely portable and executable on any platform by a JVM designed specifically for that platform.
To improve performance, the JVM generally also includes a xe2x80x9cJust-In-Timexe2x80x9d (xe2x80x9cJITxe2x80x9d) compiler for compiling the intermediate code under certain conditions, i.e., when repeated use of the same sequence of intermediate code is detected. The JVM may also be designed to optimize the intermediate code before execution. While these enhancements to the code interpretive runtime systems do provide some performance improvements, the overhead associated with making such compilation and/or optimization decisions on-the-fly can far outweigh the resulting benefits, particularly in real time applications executing in a limited resource environment.
What is needed is a method of providing optimization information to the code interpretive runtime system to assist it in executing code more effectively and in managing use of its limited resources more effectively.
The present invention is a code preparation method and system which provide optimization information to a code interpretive runtime environment operating on a first data processing platform. The code preparation system partially compiles code input on a second data processing platform to generate intermediate code or accepts as input preprocessed intermediate code, analyzes the intermediate code on the second data processing platform, then generates optimization information for optimizing further processing of the intermediate code in response to the analysis. The intermediate code and the generated instructions are provided to the code interpretive runtime environment operating on the first data processing platform. The code interpretive runtime environment is operable to use the instructions to further process the intermediate code on the first data processing platform.
The code preparation system of the present invention thus allows the code interpretive runtime environment to process the code more efficiently and to manage use of its resources more effectively, particularly when executing in a limited resource computing environment. Such limited resource computing environments include set-top boxes, digital personal assistants, etc.
In another aspect of the invention, the code interpretive runtime system is operable to selectively implement the optimization instructions in accordance with its features and those of the computing platform on which it is executing.
In another aspect of the present invention, the further processing of the intermediate code on the first data processing platform includes completing the compilation started by the code preparation system.
In yet another aspect of the invention, the optimization information is provided to the code interpretive runtime system as attributes added to class files.